--- %%NOBANNER%% -->
![]() | ![]() |
/*------------------<--- Start of Description -->--------------------\ | Power for comparison of proportion surviving between 2 groups at a| | specifed follow-up time (same formula as sv2md_pr, only percent | | survival is used instead of median survival). Provides approximate| | power for logrank test. Assumptions are uniform accrual and | | exponential survival; | |--------------------<--- End of Description -->---------------------| |--------------------------------------------------------------------| |--------------<--- Start of Files or Arguments Needed -->-----------| | Arguments: | | - Required: | | T0 = length of accrual period(uniform accrual assumed) | | T = total length of study(=T0+follow-up after last patient) | | n1,n2 = sample sizes for groups 1 and 2 respectively | | t_y = time at which survival curves are to be compared | | y1 = true group 1 proportion surviving at time t_y | | min_y2 = smallest possible true group 2 proportion surviving | | at time t_y | | - Optional: | | max_y2 = largest possible true proportion surviving at t_y in | | group 2 | | inc_y2 = increment value for range of y2 | | r = ratio of group 2/group 1 sample size(n2/n1),default=1 | | alpha = type 1 error, e.g. .01 or .05, default=.05 | | sides = 1 or 2 for 1 or 2 sided test, default=2 | | plot = 'P' for line printer plot of group 2 sample size vs y2| | 'G' for SAS/GRAPH plot of group 2 sample size vs y2 | | unit = units for time, e.g. years, months, days, hours | | Output: Power for true group 1 proportion surviving of y1(at time| | t_y) vs true group 2 survival ranging from min_y2 to max_y2 | |---------------<--- End of Files or Arguments Needed -->------------| |--------------------------------------------------------------------| |----------------<--- Start of Example and Usage -->-----------------| | Example: %sv2pt_pr (n1=136,n2=136,T_Y=5,Y1=.7,MIN_Y2=.75, | | MAX_Y2=.95,INC_Y2=.05,T0=3,T=6,PLOT=g, UNIT=yrs); | | Usage: %sv2pt_pr (ALPHA=.05,SIDES=2,T_Y=.,N1=.,N2=.,Y1=.,MIN_Y2=.,| | MAX_Y2=.,INC_Y2=.,T0=.,T=.,PLOT= , UNIT=); | | Reference: Bergstralh, EJ. SAS macros for sample size and power | | calculations. Proceedings of the 9th annual SAS Users | | Group International Conference. Equation #18. | \-------------------<--- End of Example and Usage -->---------------*/ %MACRO sv2pt_pr (ALPHA=.05,SIDES=2,T_Y=.,N1=.,N2=.,Y1=.,MIN_Y2=., MAX_Y2=.,INC_Y2=.,T0=.,T=.,PLOT= , UNIT=); /*--------------------------------------------\ | Author: Michael Riggs and Eric Bergstralh; | | Purpose: Power for comparison of proportion | | surviving between 2 groups at a | | specifed follow-up time; | \--------------------------------------------*/ OPTIONS NOCENTER MISSING=' '; %LET PLOT=%UPCASE(&PLOT); DATA T1; ALPHA=&ALPHA; SIDES=&SIDES; Y1=&Y1; MIN_Y2=&MIN_Y2; MAX_Y2=&MAX_Y2; INC_Y2=&INC_Y2; N1=&N1; N2=&N2; T_Y=&T_Y; T0=&T0; T=&T; ZALPHA=(PROBIT(1-ALPHA))*(SIDES=1) + (PROBIT(1-ALPHA/2))*(SIDES=2); IF MAX_Y2=. THEN DO; MAX_Y2=MIN_Y2+1; INC_Y2=MIN_Y2+2; *NEED 1 EXEC OF DO; END; TY1=Y1; TT=T; TT0=T0; TT_Y=T_Y; TN1=N1; TN2=N2; DO Y2=MIN_Y2 TO MAX_Y2 BY INC_Y2; LAMBDA1=-LOG(TY1)/TT_Y; LAMBDA2=-LOG(Y2)/TT_Y; LAMBD_BR=(TN1*LAMBDA1+TN2*LAMBDA2)/(TN1+TN2); IF TT0 GT 0 THEN DO; PHILBDA1=LAMBDA1**2 * 1/ (1-(EXP(-LAMBDA1*(TT-TT0))-EXP(-LAMBDA1*TT)) / (LAMBDA1*TT0) ); PHILBDA2=LAMBDA2**2 * 1/ (1-(EXP(-LAMBDA2*(TT-TT0))-EXP(-LAMBDA2*TT)) / (LAMBDA2*TT0) ); PHILBDBR=LAMBD_BR**2 * 1/ (1-(EXP(-LAMBD_BR*(TT-TT0))-EXP(-LAMBD_BR*TT)) / (LAMBD_BR*TT0) ); END; IF TT0=0 THEN DO; *ALL PTS ENTER STUDY AT SAME TIME; PHILBDA1=LAMBDA1**2/(1-EXP(-LAMBDA1*TT)); PHILBDA2=LAMBDA2**2/(1-EXP(-LAMBDA2*TT)); PHILBDBR=LAMBD_BR**2/(1-EXP(-LAMBD_BR*TT)); END; ZBETA=(ABS(LAMBDA1-LAMBDA2)- ZALPHA*SQRT(PHILBDBR*(1/TN1+1/TN2)))/ SQRT(PHILBDA1/TN1+PHILBDA2/TN2) ; POWER=PROBNORM(ZBETA); OUTPUT; END; LABEL Y1="Group 1*Proportion*Surviving*at &t_y &unit" Y2="Group 2*Proportion*Surviving*at &t_y &unit" power ='Power'; PROC PRINT SPLIT='*'; ID Y1; var Y2 POWER; TITLE2 "POWER FOR COMPARING 2 SURVIVAL CURVES--INPUT IS PROP. ALIVE AT TIME &T_y &un IT"; TItle3"Uniform accrual for &t0 &unit(T0) is assumed with analysis at &t &unit (T)"; title4 "Alpha=&alpha, Sides=&sides, N1=&n1, N2=&n2,"; title5"True Group 1 Proportion alive at &t_y &unit is &y1"; %IF &MAX_Y2 NE . %THEN %DO; %IF &PLOT= P %THEN %DO; PROC PLOT NOLEGEND; PLOT POWER*Y2/ HAXIS=&MIN_Y2 TO &MAX_Y2 BY &INC_Y2 VAXIS=0 TO 1.0 BY .10; LABEL Y2="True Group 2 proportion alive at &t_y &unit"; %END; %ELSE %IF &PLOT= G %THEN %DO; PROC GPLOT ; PLOT POWER*Y2/ vaxis=0 to 1 by .2; SYMBOL1 F=SPECIAL V=J H=1 I=j L=1; SYMBOL2 F=SPECIAL V=M H=1 I=j L=2 ; LABEL Y2="True Group 2 proportion alive at &t_y &unit"; run; quit; %END; RUN; %END; %MEND sv2pt_pr;